//点击确认按钮
document.getElementById('done').addEventListener('tap', function () {
    var userName = document.getElementById('userName').value;
    var password = document.getElementById('password').value;
    //验证输入项是否为空
    if (userName == '') {
        document.getElementById('err-msg').innerHTML = '请输入用户名';
    } else if (password == '') {
        document.getElementById('err-msg').innerHTML = '请输入密码';
    } else {
        document.getElementById('err-msg').innerHTML = '';
        /*登录*/
        mui.ajax('/admin/pc/login',{
            data:{
                username: userName,
                password: password
            },
            type:'post',//HTTP请求类型
            success:function(data){
                if(data.code==0){
                    location.href="/admin/pc/index";
                    return
                }else{
                    document.getElementById('err-msg').innerHTML = data.msg;
                }
            },
            error:function(data){
                console.log('data',data);
            }
        });
    }
})

